/* GUI CONVERTED from rewadji1.p (converter v1.76) Wed May 22 11:22:56 2002 */
/* rewadji1.p - REPETITIVE - WIP Adjust Transaction SubProg, get 2nd frame    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.11 $                                                          */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*                */
/* REVISION: 7.3      LAST MODIFIED: 03/07/95   BY: WUG *G0GQ*                */
/* REVISION: 8.6      LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 10/01/99   BY: *N014* Jeff Wootton       */
/* REVISION: 9.1      LAST MODIFIED: 10/25/99   BY: *N002* Bill Gates         */
/* REVISION: 9.1      LAST MODIFIED: 11/17/99   BY: *N04H* Vivek Gogte        */
/* REVISION: 9.1      LAST MODIFIED: 01/19/00   BY: *N077* Vijaya Pakala      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.11 $   BY: Jean Miller           DATE: 05/21/02  ECO: *P05V*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* WIP ADJUST TRANSACTION SUBPROGRAM - GET 2ND FRAME DATA FROM USER           */

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

define input parameter cumwo_lot as character.
define input parameter cumwo_op as integer.
define output parameter undo_stat like mfc_logical no-undo.

define shared variable h_wiplottrace_procs as handle no-undo.
define shared variable h_wiplottrace_funcs as handle no-undo.

{retrform.i}
define variable first_op as logical.
define variable glx_set as character.
define variable glx_mthd as character.
define variable cur_set as character.
define variable cur_mthd as character.
define variable valid_acct as logical.

{wlfnc.i} /*FUNCTION FORWARD DECLARATIONS*/
{wlcon.i}

find last wr_route where wr_lot = cumwo_lot and
                         wr_op < cumwo_op
no-lock no-error.

first_op = not available wr_route.
undo_stat = yes.

find wo_mstr where wo_lot = cumwo_lot no-lock no-error.

{gprun.i ""csavg01.p""
   "(input wo_part,
     input wo_site,
     output glx_set,
     output glx_mthd,
     output cur_set,
     output cur_mthd)" }
/*GUI*/ if global-beam-me-up then undo, leave.


do with frame adjust1 on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.


   {regetwcm.i &framename=adjust1}

   do with frame adjust1 on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.


      set
         dept
         qty_inque       when (not first_op and
                               not (is_wiplottrace_enabled() and
                                    is_operation_queue_lot_controlled
                                    (cumwo_lot, cumwo_op, INPUT_QUEUE)))
         inque_rsn_code  when (not first_op and
                               not (is_wiplottrace_enabled() and
                                    is_operation_queue_lot_controlled
                                    (cumwo_lot, cumwo_op, INPUT_QUEUE)))
         qty_outque      when (not (is_wiplottrace_enabled() and
                                    is_operation_queue_lot_controlled
                                    (cumwo_lot, cumwo_op, OUTPUT_QUEUE)))
         outque_rsn_code when (not (is_wiplottrace_enabled() and
                                    is_operation_queue_lot_controlled
                                    (cumwo_lot, cumwo_op, OUTPUT_QUEUE)))
         qty_rejque      when (not (is_wiplottrace_enabled() and
                                    is_operation_queue_lot_controlled
                                    (cumwo_lot, cumwo_op, OUTPUT_QUEUE)))
         rejque_rsn_code when (not (is_wiplottrace_enabled() and
                                    is_operation_queue_lot_controlled
                                    (cumwo_lot, cumwo_op, OUTPUT_QUEUE)))
         discr_acct      when (glx_mthd <> "avg")
         discr_sub       when (glx_mthd <> "avg")
         discr_cc        when (glx_mthd <> "avg")
      editing:

         if frame-field = "dept" then do:
            {mfnp05.i dpt_mstr dpt_dept yes dpt_dept
               "input frame adjust1 dept"}

            if recno <> ? then display dpt_dept @ dept dpt_desc.
         end.

         else
         if frame-field = "inque_rsn_code" then do:
            {mfnp05.i rsn_ref rsn_type "rsn_type = ""adjust"""
               rsn_code
               "input frame adjust1 inque_rsn_code"}

            if recno <> ? then
               display rsn_code @ inque_rsn_code.
         end.

         else
         if frame-field = "outque_rsn_code" then do:
            {mfnp05.i rsn_ref rsn_type "rsn_type = ""adjust"""
               rsn_code
               "input frame adjust1 outque_rsn_code"}

            if recno <> ? then
               display rsn_code @ outque_rsn_code.
         end.

         else
         if frame-field = "rejque_rsn_code" then do:
            {mfnp05.i rsn_ref rsn_type "rsn_type = ""adjust"""
               rsn_code
               "input frame adjust1 rejque_rsn_code"}

            if recno <> ? then
               display rsn_code @ rejque_rsn_code.
         end.

         else do:
            ststatus = stline[3].
            status input ststatus.
            readkey.
            apply lastkey.
         end.

      end.

      find dpt_mstr where dpt_dept = dept no-lock no-error.

      if not available dpt_mstr then do:
         next-prompt dept.
         {pxmsg.i &MSGNUM=532 &ERRORLEVEL=3}
         undo, retry.
      end.

      display dpt_desc.

      if glx_mthd <> "avg" then do:
         {gprunp.i "gpglvpl" "p" "initialize"}
         /* SET PROJECT VERIFICATION TO NO */
         {gprunp.i "gpglvpl" "p" "set_proj_ver" "(input false)"}
         {gprunp.i "gpglvpl" "p" "validate_fullcode"
            "(input discr_acct,
              input discr_sub,
              input discr_cc,
              input """",
              output valid_acct)"}
         if not valid_acct then do:
            next-prompt discr_acct with frame adjust1.
            undo, retry.
         end.
      end.

      if not first_op then do:

         find rsn_ref where rsn_code = inque_rsn_code
                        and rsn_type = "adjust"
         no-lock no-error.

         if not available rsn_ref and inque_rsn_code > "" then do:
            /* Reason code does not exist */
            {pxmsg.i &MSGNUM=534 &ERRORLEVEL=2 &MSGARG1=inque_rsn_code}
         end.
      end.

      find rsn_ref where rsn_code = outque_rsn_code
                     and rsn_type = "adjust"
      no-lock no-error.

      if not available rsn_ref and outque_rsn_code > "" then do:
         /* Reason code does not exist */
         {pxmsg.i &MSGNUM=534 &ERRORLEVEL=2 &MSGARG1=outque_rsn_code}
      end.

      find rsn_ref where rsn_code = rejque_rsn_code
                     and rsn_type = "adjust"
      no-lock no-error.

      if not available rsn_ref and rejque_rsn_code > "" then do:
         /* Reason code does not exist */
         {pxmsg.i &MSGNUM=534 &ERRORLEVEL=2 &MSGARG1=rejque_rsn_code}
      end.
   end.
/*GUI*/ if global-beam-me-up then undo, leave.


   undo_stat = no.

end.
/*GUI*/ if global-beam-me-up then undo, leave.

